<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="studentList">
      <el-table-column label="设备编码" align="center" prop="deviceId" />
      <el-table-column label="设备状态" align="center" prop="errorStatus">
        <template slot-scope="scope">
         {{ scope.row.errorStatus==1?'在线':'离线'}}
       </template>
      </el-table-column>
      <el-table-column label="设备名称" align="center" prop="deviceName" />
      <el-table-column label="设备类型" align="center" prop="deviceType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.deviceType_type" :value="scope.row.deviceType" />
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import { getOperation } from "@/api/base/deviceControl";

export default {
  name: "Student",
  dicts: ['deviceType_type', 'devicestatus_status', 'devicestatus_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      total:0,
      studentList:[]
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询设备运行列表 */
    getList() {
      this.loading = true;
      getOperation(this.queryParams).then(response => {
        this.studentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
  }
};
</script>
